package com.iceland.client;

import com.iceland.client.client.cmd.CmdClient;
import com.iceland.client.config.CmdServerConfig;
import com.iceland.client.config.Environment;
import com.iceland.client.config.ProxyConfig;
import com.iceland.client.config.ProxyServerConfig;
import com.iceland.client.service.StartProxyService;
import com.iceland.common.thread.MessageEventExcutor;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

@Slf4j
public class ClientApplication {
    public static void main(String[] args) {
        preStart();
        ProxyConfig proxyConfig = Environment.getProxyConfig();
        MessageEventExcutor.setCorePoolSize(proxyConfig.getCoreMessageEventThreadSize());
        MessageEventExcutor.setMaxPoolSize(proxyConfig.getMaxMessageEventThreadSize());
        CmdServerConfig cmdServer = proxyConfig.getCmdServer();
        List<ProxyServerConfig> proxyServers = proxyConfig.getProxyServers();
        proxyServers.forEach(proxyServer->{
            CmdClient cmdClient = StartProxyService.startProxy(proxyServer.getRealHost(), proxyServer.getRealPort(), proxyServer.getProxyHost(), proxyServer.getProxyPort(), cmdServer.getHost(), cmdServer.getPort());
        });

    }
    public static void preStart(){

    }



}
